import {createRouter,createWebHistory} from 'vue-router';

export default createRouter({
    //路由的模式的设置
    history:createWebHistory(),
    //管理路由
    routes:[
        {
            path:'/home',
            name:'home',
            component:()=>import('@/pages/home/index.vue')
        },
        {
            path:'/info',
            name:'info',
            component:()=>import('@/pages/info/index.vue')
        },  
        {
            path:'/expert',
            name:'expert',
            component:()=>import('@/pages/expert/index.vue')
        },
        {
            path:'/assignment',
            name:'assignment',
            component:()=>import('@/pages/assignment/index.vue')
        },
        {
            path:'/forum',
            name:'forum',
            component:()=>import('@/pages/forum/index.vue')
        },
        {
            path:'/study',
            name:'study',
            component:()=>import('@/pages/study/index.vue')
        },
        {
            path:'/product/',
            name:'product',
            component:()=>import("@/pages/product/index.vue"),
            
        },
        {
            path:'/product/:id',
            props:true,
            component:()=>import("@/pages/product/details/index.vue"),
            
        },
        {
            path:'/personal',
            name:'personal',
            component:()=>import("@/pages/personal/index.vue")
        },
        {
            path:'/livestream',
            name:'livestream',
            component:()=>import("@/pages/livestream/index.vue")
        },
        //论坛内容详情页
        {
            path:'/forum/details',
            name:'details',
            component:()=>import("@/pages/forum/details/index.vue")
        },
        {
            path:'/forum/edit',
            name:'edit',
            component:()=>import("@/pages/forum/edit/index.vue")
        },
        {
            path:'/forum/personal',
            name:'forum_person',
            component:()=>import("@/pages/forum/personal/index.vue")
        },
        {
            path:'/',
            redirect:'/home'
        }
    ],
    //滚动行为:控制滚动条的位置
    scrollBehavior(){
        return{
            left:0,
            top:0
        }
    }
})
